<?php

namespace App\Model;

use EasySwoole\ORM\AbstractModel;

/**
 * LuckyOrderModel
 * Class LuckyOrderModel
 * Create With ClassGeneration
 * @property int $id //
 * @property int $userid // 用户ID
 * @property int $round // 轮次
 * @property int $power // 助力值
 * @property int $create_time // 创建时间
 * @property int $update_time //
 * @property int $delete_time // 软删除
 * @property string $nickname // 微信昵称
 * @property string $avatar // 用户头像
 * @property string $remark // 备注
 */
class LuckyOrderModel extends BaseModel
{
	protected $tableName = 'tv_lucky_order_list';
    protected $autoTimeStamp = true;

	public function getList(int $page = 1, int $pageSize = 10, string $field = '*'): array
	{
		$list = $this
		    ->withTotalCount()
			->order($this->schemaInfo()->getPkFiledName(), 'DESC')
		    ->field($field)
		    ->page($page, $pageSize)
		    ->all();
		$total = $this->lastQueryResult()->getTotalCount();;
		return ['total' => $total, 'list' => $list];
	}
}

